package god530.com.simpleapp_slide.database;

/**
 * Created by Administrator on 2016/12/19.
 */

public class DBContants {

    /**
     * INTERGER
     * REAL
     * TEXT
     * BLOB
     * NULL
     */
    public static final String INTEGER = "INTEGER"; // 整数值是全数字(包括正和负)。整数可以是1, 2, 3, 4, 6或 8字节。整数的最大范围(8 bytes)是{-9223372036854775808, 0, +9223372036854775807}。SQLite根据数字的值自动控制整数所占的字节数。
    public static final String REAL = "REAL"; // 实数是10进制的数值。SQLite使用8字节的符点数来存储实数。
    public static final String TEXT = "TEXT"; // 文本(TEXT)是字符数据。SQLite支持几种字符编码，包括UTF-8和UTF-16。字符串的大小没有限制。
    public static final String BLOB = "BLOB"; // 二进制大对象(BLOB)是任意类型的数据。BLOB的大小没有限制。
    public static final String NULL = "NULL"; // NULL表示没有值。SQLite具有对NULL的完全支持。

    public static final String DBName = "flannery.db";
    public static final int DBVersion = 1;

    public static class SUBS {
        public static final String TABLE = "SUBS";
        public static final String ID = "id";
        public static final String NUMBER = "number";
        public static final String SUBS = "SUBS";

        public static final String CREATE_TABLE = new StringBuilder()
                .append(" CREATE TABLE ").append(TABLE)
                .append(" ( ")
                .append(ID).append(" ").append(INTEGER).append(" , ")
                .append(NUMBER).append(" ").append(TEXT).append(" , ")
                .append(SUBS).append(" ").append(TEXT)
                .append(" );")
                .toString();

        public static final String DROP_TABLE = "DROP TABLE IF EXISTS " + TABLE;
    }

    public static class TYPES {
        public static final String TABLE = "TYPES";
        public static final String ID = "id";
        public static final String SUBS = "SUBS";
        public static final String NUMBER = "number";
        public static final String TYPES = "TYPES";

        public static final String CREATE_TABLE = new StringBuilder()
                .append(" CREATE TABLE ").append(TABLE)
                .append(" ( ")
                .append(ID).append(" ").append(INTEGER).append(" , ")
                .append(SUBS).append(" ").append(TEXT).append(" , ")
                .append(NUMBER).append(" ").append(TEXT).append(" , ")
                .append(TYPES).append(" ").append(TEXT)
                .append(" );")
                .toString();

        public static final String DROP_TABLE = "DROP TABLE IF EXISTS " + TABLE;
    }

    public static class DETAILS {
        public static final String TABLE = "detail";

        public static final String ID = "id";
        public static final String TYPES = "TYPES";
        public static final String SUBS = "SUBS";
        public static final String MONEY = "MONEY";
        public static final String TIME = "TIME";

        public static final String CREATE_TABLE = new StringBuilder()
                .append(" CREATE TABLE ").append(TABLE)
                .append(" ( ")
                .append(ID).append(" ").append(INTEGER).append(" , ")
                .append(TYPES).append(" ").append(TEXT).append(" , ")
                .append(SUBS).append(" ").append(TEXT).append(" , ")
                .append(MONEY).append(" ").append(TEXT).append(" , ")
                .append(TIME).append(" ").append(INTEGER)
                .append(" );")
                .toString();
        public static final String DROP_TABLE = "DROP TABLE IF EXISTS " + TABLE;

    }


    public static void main(String [] args) {
        System.out.print("hello DBcontans.");
    }


}
